﻿namespace src.Helper
{
    public class WCDevUrl
    {
        public const string BaseUrl = "https://api.weixin.qq.com/";

        /// <summary>
        /// get accesstoken url
        /// </summary>
        /// <param name="grant_type">获取access_token填写client_credential</param>
        /// <param name="appid">第三方用户唯一凭证</param>
        /// <param name="secret">第三方用户唯一凭证密钥，即appsecret</param>
        /// <returns></returns>
        public static string GetAccessTokenUrl(string grant_type, string appid, string secret)
        {
            return $"{BaseUrl}cgi-bin/token?grant_type={grant_type}&appid={appid}&secret={secret}";
        }

        /// <summary>
        /// get wechat servers ip list
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetWCServerIp(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/getcallbackip?access_token={accessToken}";
        }

        /// <summary>
        /// get net check url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetNetCheckUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/callback/check?access_token={accessToken}";
        }

        /// <summary>
        /// get createMenu url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetCreateMenuUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/menu/create?access_token={accessToken}";
        }

        /// <summary>
        /// get searchMenu url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetSearchMenuUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/menu/get?access_token={accessToken}";
        }

        /// <summary>
        /// get delMenu url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetDelMenuUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/menu/delete?access_token={accessToken}";
        }

        /// <summary>
        /// get create ConditionalMenu url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetCreateConditionalUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/menu/addconditional?access_token={accessToken}";
        }

        /// <summary>
        /// get del ConditionalMenu url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetDelConditionalUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/menu/delconditional?access_token={accessToken}";
        }

        /// <summary>
        /// get test ConditionalMenu url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetTestConditionalUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/menu/trymatch?access_token={accessToken}";
        }

        /// <summary>
        /// get current self menu url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetSelfMenuUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/menu/get_current_selfmenu_info?access_token={accessToken}";
        }

        /// <summary>
        /// get create kfaccount url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetAddKFAccountUrl(string accessToken)
        {
            return $"{BaseUrl}customservice/kfaccount/add?access_token={accessToken}";
        }

        /// <summary>
        /// get update kfaccount url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetUpdateKFAccountUrl(string accessToken)
        {
            return $"{BaseUrl}customservice/kfaccount/update?access_token={accessToken}";
        }

        /// <summary>
        /// get del kfaccount url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetDelKFAccountUrl(string accessToken)
        {
            return $"{BaseUrl}customservice/kfaccount/del?access_token={accessToken}";
        }

        /// <summary>
        /// get upload kfavator url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <param name="kfAccount">客服账号</param>
        /// <returns></returns>
        public static string GetUploadKFAcatorUrl(string accessToken,string kfAccount)
        {
            return $"{BaseUrl}customservice/kfaccount/uploadheadimg?access_token={accessToken}$kf_account={kfAccount}";
        }

        /// <summary>
        /// get kfaccountlist url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetAllKFAccountUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/customservice/getkflist?access_token={accessToken}";
        }

        /// <summary>
        /// get media upload url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <param name="type">media type</param>
        /// <returns></returns>
        public static string GetMediaUploadUrl(string accessToken,string type)
        {
            return $"{BaseUrl}cgi-bin/media/upload?access_token={accessToken}&type={type}";
        }

        /// <summary>
        /// get get media url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <param name="mediaId">media_id</param>
        /// <returns></returns>
        public static string GetMediaUrl(string accessToken,string mediaId)
        {
            return $"{BaseUrl}cgi-bin/media/get?access_token={accessToken}&media_id={mediaId}";
        }

        /// <summary>
        /// get add new media url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetAddNewMediaUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/material/add_news?access_token={accessToken}";
        }

        /// <summary>
        /// get upload material img url
        /// </summary>
        /// <param name="accessToken">公众号的access_token</param>
        /// <returns></returns>
        public static string GetUploadMaterialImgUrl(string accessToken)
        {
            return $"{BaseUrl}cgi-bin/media/uploadimg?access_token={accessToken}";
        }
    }
}
